package com.kedi.entity;

import com.alibaba.fastjson.JSON;

import java.util.List;
import java.util.Objects;

/**
 * @author Zyred
 * redis中保存token为键的 value参数对象
 */
public class RedisUserInfo {

    /**
     * 用户登录的标识， 如果想知道用户具体那些标识，请查看LoginAction类中枚举
     */
    private String mode;

    /**
     *  用户能访问的资源地址集合
     */
    private List<String> urls;

    /**
     * 用户的身份证号码
     */
    private String idcard;

    private String id;

    private String password;

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public List<String> getUrls() {
        return urls;
    }

    public void setUrls(List<String> urls) {
        this.urls = urls;
    }

    public String getIdcard() {
        return idcard;
    }

    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RedisUserInfo that = (RedisUserInfo) o;
        return Objects.equals(mode, that.mode) &&
                Objects.equals(urls, that.urls) &&
                Objects.equals(idcard, that.idcard) &&
                Objects.equals(id, that.id) &&
                Objects.equals(password, that.password);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mode, urls, idcard, id, password);
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
